﻿using System.Linq.Expressions;

namespace Stickers.Common.DataAccess;

public interface ISimplifiedDataAccessor
{
    Task<int> AddAsync<TEntity>(string tenantId, TEntity entity, CancellationToken cancellationToken = default)
        where TEntity : class, IEntity;

    Task<int> RemoveByIdAsync<TEntity>(string tenantId, int id, CancellationToken cancellationToken = default)
        where TEntity : class, IEntity;

    Task<TEntity?> GetByIdAsync<TEntity>(string tenantId, int id, CancellationToken cancellationToken = default)
        where TEntity : class, IEntity;

    Task<int> UpdateAsync<TEntity>(string tenantId, int id, TEntity entity, CancellationToken cancellationToken = default)
        where TEntity : class, IEntity;

    Task<Paginated<TEntity>> GetPaginatedEntitiesAsync<TEntity, TField>(string tenantId, 
        Expression<Func<TEntity, TField>> orderByExpression,
        bool sortAscending = true, int pageSize = 25, int pageNumber = 1,
        Expression<Func<TEntity, bool>>? filterExpression = null, CancellationToken cancellationToken = default)
        where TEntity : class, IEntity;

    Task<bool> ExistsAsync<TEntity>(string tenantId, 
        Expression<Func<TEntity, bool>> filterExpression,
        CancellationToken cancellationToken = default) 
        where TEntity : class, IEntity;
}